# Contributor: Tuan Hoang <tmhoang@linux.ibm.com>
# Maintainer: Tuan Hoang <tmhoang@linux.ibm.com>
pkgname=yq
pkgver=3.3.2
pkgrel=0
pkgdesc="portable command-line YAML processor written in Go"
url="https://github.com/mikefarah/yq"
arch="all !mips !mips64" # limited by go
license="MIT"
makedepends="go govendor"
options="chmod-clean"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz"

builddir="$srcdir/${url##*//}"

prepare() {
	mkdir -p ${builddir%/*}
	mv "$srcdir"/$pkgname-$pkgver "$builddir"/
	default_prepare
}

build() {
	GOPATH="$srcdir" go build -v
}

check() {
	GOPATH="$srcdir" go test
}

package() {
	install -Dm755 yq "$pkgdir"/usr/bin/yq
	for file in LICENSE README.md; do
		install -Dm644 $file "$pkgdir"/usr/share/doc/$pkgname/$file
	done
}

sha512sums="8a4ea10afd4be7417684996f7e8320b1b7cfa06e2d338884948785767efdffd57d60791d00b10ff70c47eac17424cea86f2e4ca69ea80524e7a1e0d2fe2424f8  yq-3.3.2.tar.gz"
